function assignCustomAdboardIDs()
--------------------------------------------------------------------------------------------------------------
--PLACE CUSTOM  ASSIGNMENTS BELOW HERE
--------------------------------------------------------------------------------------------------------------




--------------------------------------------------------------------------------------------------------------
--PLACE CUSTOM ASSIGNMENTS ABOVE HERE
--------------------------------------------------------------------------------------------------------------
end

--------------------------------------------------------------------------------------------------------------

function StadiumUpdate(idx)
	local as = gSportsRNA
	local stadium = as:GetTable("wvStadium", idx)
	
	local wipe3d = as:GetTable("wvWipe", idx)
	
	db.wipe3d[idx].leagueID = as:GetInt(wipe3d, "leagueID")
	
	db.wipe3d[idx].leagueID = getTournamentGraphics(db.wipe3d[idx].leagueID)

    db.stadium[idx].lightType = as:GetInt(stadium, "stadLightType")
	db.stadium[idx].stadiumID = as:GetInt(stadium, "stadID")
	db.stadium[idx].prefix = as:GetString(stadium, "stadNamePrefix")
	db.stadium[idx].pitchColor = as:GetInt(stadium, "stadLightType")
	db.stadium[idx].mowPattern = as:GetInt(stadium, "pitchMowPattern")
	db.stadium[idx].wearPattern = as:GetInt(stadium, "pitchWearPattern")
	
	db.stadium[idx].adboardID = as:GetInt(stadium, "adboardID" )
	--db.stadium[idx].adboardGroup = as:GetInt(stadium, "adboardGroup" )
	db.stadium[idx].adboardGroup = 0
	
	db.stadium[idx].homeKitTeamID = as:GetInt(stadium, "homeKitTeamID" )
	db.stadium[idx].homeKitTypeID = as:GetInt(stadium, "homeKitTypeID" )
	db.stadium[idx].awayKitTeamID = as:GetInt(stadium, "awayKitTeamID" )
	db.stadium[idx].awayKitTypeID = as:GetInt(stadium, "awayKitTypeID" )
	
	db.stadium[idx].isHomeFCZ = as:GetInt(stadium, "isHomeCreationZone")
	db.stadium[idx].isAwayFCZ = as:GetInt(stadium, "isAwayCreationZone")
	
	db.stadium[idx].homeTeamAssetId = as:GetInt(stadium, "homeTeamAssetId")
	db.stadium[idx].hasCzCrestImage = as:GetInt(stadium, "hasCzCrestImage")
	
	db.stadium[idx].homePrimaryColour = as:GetInt(stadium, "homePrimaryColour")
	db.stadium[idx].homeSecondaryColour = as:GetInt(stadium, "homeSecondaryColour")
	db.stadium[idx].awayPrimaryColour = as:GetInt(stadium, "awayPrimaryColour")
	db.stadium[idx].awaySecondaryColour = as:GetInt(stadium, "awaySecondaryColour")
	
	db.stadium[idx].homeBannerId = db.stadium[idx].homeKitTeamID
	db.stadium[idx].awayBannerId = db.stadium[idx].awayKitTeamID
	
	db.stadium[idx].homeBannerPrimaryColour = 0xffff0000
	db.stadium[idx].homeBannerSecondaryColour = 0xff00ff00
	db.stadium[idx].awayBannerPrimaryColour = 0xffff0000
	db.stadium[idx].awayBannerSecondaryColour = 0xff00ff00
	
	if ( db.stadium[idx].isHomeFCZ == 1 ) then
		db.stadium[idx].homeBannerId = 7500
		db.stadium[idx].homeBannerPrimaryColour = db.stadium[idx].homePrimaryColour
		db.stadium[idx].homeBannerSecondaryColour = db.stadium[idx].homeSecondaryColour
	end
	
	if ( db.stadium[idx].isAwayFCZ == 1 ) then
		db.stadium[idx].awayBannerId = 7500
		db.stadium[idx].awayBannerPrimaryColour = db.stadium[idx].awayPrimaryColour
		db.stadium[idx].awayBannerSecondaryColour = db.stadium[idx].awaySecondaryColour
	end
	
	-- some teams require to swap crowd and banners location
	local swapHomeAwayCrowd = as:GetInt(stadium, "swapHomeAwayCrowd")
	if ( swapHomeAwayCrowd == 1 ) then
		db.stadium[idx].homeBannerId, db.stadium[idx].awayBannerId = db.stadium[idx].awayBannerId, db.stadium[idx].homeBannerId
		db.stadium[idx].homeBannerPrimaryColour, db.stadium[idx].awayBannerPrimaryColour = db.stadium[idx].awayBannerPrimaryColour, db.stadium[idx].homeBannerPrimaryColour
		db.stadium[idx].homeBannerSecondaryColour, db.stadium[idx].awayBannerSecondaryColour = db.stadium[idx].awayBannerSecondaryColour, db.stadium[idx].homeBannerSecondaryColour
	end
	
	
	initAdboardArray()
	assignCustomAdboardIDs()
	db.stadium[idx].adboardID = getAdboardID(db.stadium[idx].homeKitTeamID,db.stadium[idx].adboardID,db.wipe3d[idx].leagueID,idx,db.stadium[idx].stadiumID)
	
	db.stadium[idx].stadTexID = getTournamentStadTex(db.stadium[idx].stadiumID,db.wipe3d[idx].leagueID,0)
	
	db.stadium[idx].mowPattern = getMowPattern(db.stadium[idx].homeKitTeamID,db.stadium[idx].mowPattern)
	
end

function GetHomeKitAssetSrc(idx)
	if ( db.stadium[idx].isHomeFCZ == 1 ) then
		if ( db.stadium[idx].hasCzCrestImage > 0 ) then
			return "data/ugc/cz_crest/${db.stadium[?].homeTeamAssetId}.png;data/ugc/cz_crest/1.png"
		else
			return "data/sceneassets/crest/crest_${db.stadium[?].homeTeamAssetId}.rx3"
		end
	else
		return "data/ui/imgassets/crest/l${db.stadium[?].homeKitTeamID}.dds"
	end
end

function GetCrestTexName(idx)
	if ( db.stadium[idx].hasCzCrestImage > 0 ) then
		return "png"
	else
		return ""
	end
end

function StadiumAssetBind(stadium)
	local gr = gRenderables
	local lod = 0
	local priority = 1	-- Load all the stadium assets at a higher priority than the rest, so we can get it loaded early
	local banneridx = 0
	local maxbanners = 11
	--local stadiumAsset = "data/sceneassets/stadium/${db.stadium[?].prefix}_${db.stadium[?].stadiumID}_${db.stadium[?].lightType}_container_0.rx3;data/sceneassets/stadium/${db.stadium[?].prefix}_666_1_container_0.rx3"
	local stadiumAsset = "data/sceneassets/stadium/${db.stadium[?].prefix}_${db.stadium[?].stadiumID}_${db.stadium[?].lightType}_container_${db.stadium[?].stadTexID}.rx3;data/sceneassets/stadium/${db.stadium[?].prefix}_666_1_container_0.rx3"
	
	-- Get all assets we require in...
	gr:AddCallback(stadium, lod, "StadiumUpdate(?)")
	gr:AddAsset(stadium, lod, "shader", "data/fifarna/shader.big")

	gr:AddAsset(stadium, lod, "stadium",                          stadiumAsset, priority)
	
	-- Assets we need to intercept
	gr:AddAsset(stadium, lod, "pitchambient",                     stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "pitchnolineambient",               stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "jumbotronambient",                 stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "adboardambient",                   stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "adboardscrollingambient",          stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "adboarddigitalambient",            stadiumAsset, priority)
    gr:AddAsset(stadium, lod, "adboarddigitalglow",               stadiumAsset, priority)
    gr:AddAsset(stadium, lod, "adboarddigitalglowambient",        stadiumAsset, priority)
    gr:AddAsset(stadium, lod, "adboardsingledigitalambient",      stadiumAsset, priority)
    gr:AddAsset(stadium, lod, "adboardsingledigitalglow",         stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "adboardsingledigitalglowambient",  stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "crestambient",                     stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "homeprimaryambient",               stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "homesecondaryambient",             stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "bannerhomeambient",                stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "bannerawayambient",                stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "pitchadambient",                   stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "diffuseshadow",                    stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "diffuseshadowambient",             stadiumAsset, priority)
	
	gr:AddAsset(stadium, lod, "sclockhalvesambient",              stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "sclocktimeanalogambient",          stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "sclockminutesonesambient",         stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "sclockminutestensambient",         stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "sclocksecondsonesambient",         stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "sclocksecondstensambient",         stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "sclockscorehomeonesambient",      stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "sclockscorehometensambient",       stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "sclockscoreawayonesambient",      stadiumAsset, priority)
	gr:AddAsset(stadium, lod, "sclockscoreawaytensambient",       stadiumAsset, priority)

	
	-- Stadium Banners with dynamic distribution  (Not used on Fifa)
    --local bannermat
	--for banneridx=0, maxbanners-1 do 
	--	bannermat = string.format( "banner%sambient", banneridx )
	--	gr:AddAsset(stadium, lod, bannermat,                      stadiumAsset, priority)
	--end
	
	
	-- Additional assets to load
	gr:AddAsset(stadium, lod, "mow", "data/sceneassets/pitch/pitchmowpattern_${db.stadium[?].mowPattern}_textures.rx3", priority)
	gr:AddAsset(stadium, lod, "cmn", "data/sceneassets/pitch/pitch_common_textures.rx3", priority)
	gr:AddAsset(stadium, lod, "cov", "data/sceneassets/pitch/pitchcovmap_${db.stadium[?].stadiumID}_${db.stadium[?].lightType}_textures.rx3", priority)
	gr:AddAsset(stadium, lod, "col", "data/sceneassets/pitch/pitchcolor_${db.stadium[?].pitchColor}_textures.rx3", priority)
	gr:AddAsset(stadium, lod, "globaltex", "data/sceneassets/globaltex/globaltex_0.rx3", priority)
	gr:AddAsset(stadium, lod, "wear", "data/sceneassets/pitch/pitchwearpattern_${db.stadium[?].wearPattern}_textures.rx3", priority)
	--TODO direct it into host city texture
	gr:AddAsset(stadium, lod, "adboardsingletex", "data/sceneassets/adboard/adboard_${db.stadium[?].adboardID}_${db.stadium[?].adboardGroup}.rx3", priority)
	gr:AddAssetEx(stadium, lod, "extracttexture ${GetCrestTexName(?)}", "homecresttex", "${GetHomeKitAssetSrc(?)}")
	gr:AddAsset(stadium, lod, "homebannertex", "data/sceneassets/banner/banner_${db.stadium[?].homeBannerId}.rx3;data/sceneassets/banner/banner_0.rx3", priority)
	gr:AddAsset(stadium, lod, "awaybannertex", "data/sceneassets/banner/banner_${db.stadium[?].awayBannerId}.rx3;data/sceneassets/banner/banner_0.rx3", priority)
	gr:AddAsset(stadium, lod, "pitchadtex", "data/sceneassets/pitchad/pitchad_${db.stadium[?].adboardID}.rx3", priority)

	-- Now generate custom materials (these should be named after the shader they are to replace)
	-- Pitch 
	local part = "pitchambient"
	gr:CreateMaterial(stadium, lod, part, "hdr_pitch.fx")
	gr:SetTexture(stadium, lod, part, "textures", "noiseTexture", "globaltex", "multiFreq_noise")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "col", "grass_color")
	-- ambient should magically be populated by the original state block of the stadium
	gr:SetTexture(stadium, lod, part, "textures", "normalMap", "mow", "grass_normal")
	gr:SetTexture(stadium, lod, part, "textures", "alphamask", "wear", "grass_wear")
	gr:SetTexture(stadium, lod, part, "textures", "pitchLinesMap", "cmn", "grass_pitchlines")
	gr:SetTextureFromRuntime(stadium, lod, part, "textures", "PitchFlatShadow", "flatshadows")
	
	part = "pitchnolineambient"
	gr:CreateMaterial(stadium, lod, part, "hdr_pitchnoline.fx")
	gr:SetTexture(stadium, lod, part, "textures", "noiseTexture", "globaltex", "multiFreq_noise")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "col", "grass_color")
	-- ambient should magically be populated by the original state block of the stadium
	-- gr:SetTexture(stadium, lod, part, "textures", "normalMap", "mow", "grass_normal")
	-- gr:SetTexture(stadium, lod, part, "textures", "alphamask", "wear", "grass_wear")
	gr:SetTextureFromRuntime(stadium, lod, part, "textures", "PitchFlatShadow", "flatshadows")

	-- Render to texture jumbotron
	part = "jumbotronambient"
	-- gr:CreateMaterialFromAttribulator(stadium, lod, part, "jumbotronambient", "${AttribMaterial('jumbotronambient')}")
	gr:CreateMaterial(stadium, lod, part, "jumbotron.fx")
	gr:SetTextureFromRuntime(stadium, lod, part, "textures", "jumbotronMap", "FrameGrab0")
	gr:SetTexture(stadium, lod, part, "textures", "LEDTexture", "globaltex", "LED_cm")
	
	-- Stadium Adboards
	-- All of them redirected into runtime texture managed by adboard renderable
	-- The exception is adboardsingledigitalambient and adboardsingledigitalglowambient which
	-- show a completely different not switching texture all the time
	part = "adboardambient"
	gr:CreateMaterial(stadium, lod, part, "adboardambient.fx")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "adboardsingletex", "adboard")
	
	part = "adboardscrollingambient"
	gr:CreateMaterial(stadium, lod, part, "adboardscrollingambient.fx")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "adboardsingletex", "adboard")

	part = "adboarddigitalambient"
	gr:CreateMaterial(stadium, lod, part, "adboarddigitalambient.fx")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "adboardsingletex", "adboard")
	gr:SetTexture(stadium, lod, part, "textures", "incandescenceMap", "globaltex", "digitalgrid_cm")	

	part = "adboarddigitalglow"
	gr:CreateMaterial(stadium, lod, part, "adboarddigitalglowambient.fx")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "adboardsingletex", "adboard")

	part = "adboarddigitalglowambient"
	gr:CreateMaterial(stadium, lod, part, "adboarddigitalglowambient.fx")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "adboardsingletex", "adboard")

	-- The home team crest in the stadium
	part = "crestambient"
	-- gr:CreateMaterialFromAttribulator(stadium, lod, part, "crestambient", "${AttribMaterial('crestambient')}")
	gr:CreateMaterial(stadium, lod, part, "env_Diff.fx")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "homecresttex", "${GetCrestTexName(?)}")
	
	-- Stadium Banners
	part = "bannerhomeambient"
	gr:CreateMaterial(stadium, lod, part, "env_DiffColourSub.fx")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "homebannertex", "banner_")
	gr:SetConstantARGB(stadium, lod, part, "global", "customColorPri", "${db.stadium[?].homeBannerPrimaryColour}")
	gr:SetConstantARGB(stadium, lod, part, "global", "customColorSec", "${db.stadium[?].homeBannerSecondaryColour}")
	
	part = "bannerawayambient"
	gr:CreateMaterial(stadium, lod, part, "env_DiffColourSub.fx")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "awaybannertex", "banner_")
	gr:SetConstantARGB(stadium, lod, part, "global", "customColorPri", "${db.stadium[?].awayBannerPrimaryColour}")
	gr:SetConstantARGB(stadium, lod, part, "global", "customColorSec", "${db.stadium[?].awayBannerSecondaryColour}")

    ------------------------------------------------------------------------------------------------------
	-- Stadium Banners with dynamic distribution (Not used on Fifa)
	--local texname
	--for banneridx=0, maxbanners-1 do 
	--	part = string.format( "banner%sambient", banneridx )
	--	texname = string.format( "banner%s", banneridx )
	--	gr:CreateMaterial(stadium, lod, part, "env_Diff.fx")
	--	gr:SetTextureFromRuntime(stadium, lod, part, "textures", "diffuseTexture", texname)
	--end
    ------------------------------------------------------------------------------------------------------

	-- Team colours
	part = "homeprimaryambient"
	gr:CreateMaterial(stadium, lod, part, "env_DiffColour.fx")
	gr:SetConstantARGB(stadium, lod, part, "global", "envColour", "${db.stadium[?].homePrimaryColour}")
	
	part = "homesecondaryambient"
	gr:CreateMaterial(stadium, lod, part, "env_DiffColour.fx")
	gr:SetConstantARGB(stadium, lod, part, "global", "envColour", "${db.stadium[?].homeSecondaryColour}")
	
	-- Pitch adboards (fake 3d)
	part = "pitchadambient"
	gr:CreateMaterial(stadium, lod, part, "env_Diff.fx")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "pitchadtex", "pitchad")
	
	
	-- Flatshadow enabled geometry
	part = "diffuseshadowambient"
	gr:CreateMaterial(stadium, lod, part, "env_Diff_flatshadow.fx")
	gr:SetTextureFromRuntime(stadium, lod, part, "textures", "PitchFlatShadow", "flatshadows")
	
	-- Flatshadow enabled geometry
	part = "diffuseshadow"
	gr:CreateMaterial(stadium, lod, part, "env_Diff_flatshadow.fx")
	gr:SetTextureFromRuntime(stadium, lod, part, "textures", "PitchFlatShadow", "flatshadows")
	
	-- Dynamic Scoreclock
	part = "sclocktimeanalogambient"
	gr:CreateMaterial(stadium, lod, part, "uvoffset.fx")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "globaltex", "sclock_analog")
	
	part = "sclockhalvesambient"
	gr:CreateMaterial(stadium, lod, part, "uvoffset.fx")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "globaltex", "sclock_digits")
	
	part = "sclockminutesonesambient"
	gr:CreateMaterial(stadium, lod, part, "uvoffset.fx")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "globaltex", "sclock_digits")
	
	part = "sclockminutestensambient"
	gr:CreateMaterial(stadium, lod, part, "uvoffset.fx")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "globaltex", "sclock_digits")
	
	part = "sclocksecondsonesambient"
	gr:CreateMaterial(stadium, lod, part, "uvoffset.fx")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "globaltex", "sclock_digits")
	
	part = "sclocksecondstensambient"
	gr:CreateMaterial(stadium, lod, part, "uvoffset.fx")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "globaltex", "sclock_digits")
	
	part = "sclockscorehomeonesambient"
	gr:CreateMaterial(stadium, lod, part, "uvoffset.fx")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "globaltex", "sclock_digits")
	
	part = "sclockscorehometensambient"
	gr:CreateMaterial(stadium, lod, part, "uvoffset.fx")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "globaltex", "sclock_digits")
	
	part = "sclockscoreawayonesambient"
	gr:CreateMaterial(stadium, lod, part, "uvoffset.fx")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "globaltex", "sclock_digits")
	
	part = "sclockscoreawaytensambient"
	gr:CreateMaterial(stadium, lod, part, "uvoffset.fx")
	gr:SetTexture(stadium, lod, part, "textures", "diffuseTexture", "globaltex", "sclock_digits")
	
	
end

allAdboards = {}
tournamentAdboards = {}
stadiumAdboards = {}

function initAdboardArray()

adboardID1 = {278,280,393,687,688,689,691,693,694,695,696,697,698,974,980,981,982,983,1318,1322,1325,1327,
1328,1331,1334,1335,1337,1338,1343,1352,1353,1354,1355,1356,1357,1359,1361,1362,1363,1364,1365,1369,1370,
1377,1386,1387,1395,1415,1473,1474,1475,1476,1477,1478,1876,1877,1884,1886,2055,2056,101085,101112,105035,
110081,110765,110929,110930,111065,111070,111072,111099,111108,111109,111112,111130,111140,111144,111205,
111459,111465,111473,111588,111592,111651,111928,112115,112134,112258,112264}
adboardID2 = {1,2,3,4,5,7,9,10,11,13,15,18,106,109,110,144,1792,1806,1917,1960}
adboardID3 = {8,12,14,17,19,77,78,80,81,82,83,86,88,89,91,94,95,97,121,127,135,142,143,147,181,182,346,
357,361,373,382,620,1480,1790,1793,1794,1795,1796,1797,1798,1799,1800,1801,1802,1803,1804,1807,1808,
1919,1920,1924,1925,1926,1928,1929,1930,1932,1933,1934,1935,1936,1937,1938,1939,1941,1943,1945,1946,
1949,1951,1952,1954,1955,1958,1959,1961,1962,15015,15048,100804,100805,110313,110890,112259}
adboardID5 = {240,241,242,243,244,448,449,450,452,453,456,457,459,461,462,468,472,477,479,480,481,483,
571,573,1742,1853,1855,1860,1861,1867,15019,15021,100831,100851,100879,110062,110704,110832,110833,
110839,110902,111827}
adboardID7 = {57,58,59,62,64,65,66,68,69,70,71,72,73,74,210,212,217,219,226,294,378,379,613,614,1530,
1738,1739,1809,1814,1815,1816,1819,1820,1823,110326,110456,110569,111271,111376,111989}
adboardID9 = {39,44,45,46,47,48,50,52,54,55,189,190,192,200,203,206,347,1744,1746,1837,1838,1842,1843,
1844,1846,1847,1848,2044,110364,110374,110556,110734,110912,110915,111491,111974,111993,112124,112225,
112237,112281,112282}
adboardID11 = {229,231,232,239,673,674,675,680,681,1747,1750,2007,15005,100081,100087,110724}
adboardID12 = {269,270,271,272,819,820,826,1446,1447,1516,1788,15001}
adboardID13 = {298,299,300,417,418,917,919,920,922,1456,1463,1465,1524,1755,2041,112199}
adboardID14 = {245,246,247,635,650,1902,1903,1904,1905,1906,1908,1909,1910,1913,1915,1971,100634,100651}
adboardID15 = {319,320,321,432,433,700,702,703,705,710,711,1439,111277,111594,112072,112267}
adboardID16 = {191,209,254,256,780,1785,2045,15011,111373,111821}
adboardID17 = {322,324,435,894,896,897,900,1715,1862,110770}
adboardID18 = {21,22,23,25,27,28,29,31,32,33,34,36,38,160,162,165,166,169,171,175,485,503,506,1824,
1825,1826,1831,1832,10029,10030,100409,110329,110500,110596,110636,111239}
adboardID24 = {1028,1032,1878,1879,1880,1881,1882,1970,101114,101116,110144,110147,110149,110150,110151,110152,110780,111678}
adboardID25 = {234,236,237,665,744,1887,1888,1891,1892,1893,1895,1896,1897,1901,10019,111540}
adboardID26 = {301,420,873,874,1570,1871,1873,110744,110745,110747,110749,111083,111085,111087,111091,111092}
adboardID32 = {383,517,567,568,569,598,1035,1039,1041,1043,1048,1053,1598,1629,111044,111045,111059,111976,112001,112119}
adboardID34 = {305,306,423,445,563,837,838,1571,1572,111132}
adboardID35 = {111393,111395,111396,111397,111398,111399,111400,111766,112078,112224}
adboardID37 = {325}
adboardID38 = {312,315,100764,100765,100766,100767,100769,110089,110103,110109,110227,110231,110233,110234,112217,112218}

for i=1,#adboardID1 do
allAdboards[adboardID1[i]] = 1
end

for i=1,#adboardID2 do
allAdboards[adboardID2[i]] = 2
end

for i=1,#adboardID3 do
allAdboards[adboardID3[i]] = 3
end

for i=1,#adboardID5 do
allAdboards[adboardID5[i]] = 5
end

for i=1,#adboardID7 do
allAdboards[adboardID7[i]] = 7
end

for i=1,#adboardID9 do
allAdboards[adboardID9[i]] = 9
end

for i=1,#adboardID11 do
allAdboards[adboardID11[i]] = 11
end

for i=1,#adboardID12 do
allAdboards[adboardID12[i]] = 12
end

for i=1,#adboardID13 do
allAdboards[adboardID13[i]] = 13
end

for i=1,#adboardID14 do
allAdboards[adboardID14[i]] = 14
end

for i=1,#adboardID15 do
allAdboards[adboardID15[i]] = 15
end

for i=1,#adboardID16 do
allAdboards[adboardID16[i]] = 16
end

for i=1,#adboardID17 do
allAdboards[adboardID17[i]] = 17
end

for i=1,#adboardID18 do
allAdboards[adboardID18[i]] = 18
end

for i=1,#adboardID24 do
allAdboards[adboardID24[i]] = 24
end

for i=1,#adboardID25 do
allAdboards[adboardID25[i]] = 25
end
for i=1,#adboardID26 do
allAdboards[adboardID26[i]] = 26
end

for i=1,#adboardID32 do
allAdboards[adboardID32[i]] = 32
end

for i=1,#adboardID34 do
allAdboards[adboardID34[i]] = 34
end

for i=1,#adboardID35 do
allAdboards[adboardID35[i]] = 35
end

for i=1,#adboardID37 do
allAdboards[adboardID37[i]] = 37
end

for i=1,#adboardID38 do
allAdboards[adboardID38[i]] = 38
end

end

function getAdboardID(team,ad,tourn,idx,stad)

if (globalAdboardsEnabled) then
return globalAdboardsID
elseif ((idx == 0) and (arenaModeAdboard ~= -1)) then
return arenaModeAdboard
elseif (tournamentAdboards[tourn] ~= nil) then
return tournamentAdboards[tourn]
elseif (stadiumAdboards[stad] ~= nil) then
return stadiumAdboards[stad]
elseif (allAdboards[team] ~= nil) then
return allAdboards[team]
else
return ad
end

end

function assignAdboard(team,ad)
allAdboards[team] = ad
end

function assignTeamAdboard(team,ad)
allAdboards[team] = ad
end

function assignTournamentAdboard(tourn,ad)
tournamentAdboards[tourn] = ad
end

function assignStadiumAdboard(stad,ad)
stadiumAdboards[stad] = ad
end

globalAdboardsEnabled = false
globalAdboardsID = 1

function useGlobalAdboard(ad)
globalAdboardsEnabled = true
globalAdboardsID = ad
end

tournStadTex = {}

function assignTournamentStadTex(stad,tourn,id)

if (tournStadTex[stad] == nil) then
tournStadTex[stad] = {}
end

tournStadTex[stad][tourn] = id
end

function getTournamentStadTex(stad,tourn,id)

if (tournStadTex[stad] ~= nil) then
if (tournStadTex[stad][tourn] ~= nil) then
return tournStadTex[stad][tourn]
end
end

return id
end


arenaModeAdboard = -1

function setArenaModeAdboard(id)
arenaModeAdboard = id
end

frTourn = -1

function useTournamentGraphicsInFriendly(id)
frTourn = id
end

function getTournamentGraphics(id)
if (id == -1) then
return frTourn
end

return id
end


mowPatturns = {}

function assignMowPattern(team,mow)
mowPatturns[team] = mow
end

function getMowPattern(team,mow)

if (mowPatturns[team] ~= nil) then
return mowPatturns[team]
else
return mow
end

end

--Revolution Mod V1.2
--Edited by scouser09
